<template>
  <menu-tree :no-children="noChildren" :has-children="hasChildren" :collapse="collapse">
    <div>
      <h4 v-show="!collapse">KY规划生产小系统</h4>
      <h4 v-show="collapse">KY规划</h4>
    </div>
  </menu-tree>
</template>

<script>
import MenuTree from "../../components/MenuTree";

export default {
  name: "NavBar",
  components: {
    MenuTree
  },
  props: {
    collapse: Boolean
  },
  computed: {
    noChildren() {
      return this.asideMenu.filter(item => !item.children);
    },
    hasChildren() {
      return this.asideMenu.filter(item => item.children);
    }
  },
  data() {
    return {
      asideMenu: [
        {
          path: "/",
          name: "home",
          label: "首页",
          icon: "s-home"
        },
        {
          path: "/plan",
          // name: "plan",
          label: "计划编制",
          icon: "edit-outline",
          children: [
            {
              path: "/baseScheduleImport",
              name: "baseScheduleImport",
              label: "班表生成",
              icon: "folder-add"
            },
            {
              path: "/scheduleQX",
              name: "scheduleQX",
              label: "取班维护",
              icon: "document-remove"
            },
            {
              path: "/schedule",
              name: "schedule",
              label: "班表查询",
              icon: "s-data"
            }
          ]
        },
        {
          path: "/plane",
          // name: "plane",
          label: "飞机信息",
          icon: "s-promotion",
          children: [
            {
              path: "/planeInfo",
              name: "planeInfo",
              label: "信息维护",
              icon: "folder-add"
            },
            {
              path: "/planeAge",
              name: "planeAge",
              label: "机龄查询",
              icon: "search"
            },
            {
              path: "/regPlane",
              name: "regPlane",
              label: "在册查询",
              icon: "search"
            }
          ]
        },
        {
          path: "/queryDate",
          // name: "queryDate",
          label: "数据查询",
          icon: "search",
          children: [
            {
              path: "/history",
              name: "history",
              label: "历史数据",
              icon: "document"
            },
            {
              path: "/distance",
              name: "distance",
              label: "距离查询",
              icon: "document"
            },
            {
              path: "/kbquery",
              name: "kbquery",
              label: "快报底表查询",
              icon: "document"
            }
          ]
        }
        // {
        //   path: "/UserManagement",
        //   name: "UserManagement",
        //   label: "用户管理",
        //   icon: "user"
        // }
      ]
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    clickMenu(item) {
      this.$router.push(item.path);
      this.$store.commit("selectMenu", item);
    }
  }
};
</script>

<style lang="scss" scoped>
.el-menu-vertical-demo {
  background-color: $theme-color;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>
